/*
 * Copyright (C) 2010 TopCoder Inc., All Rights Reserved.
 */
package com.hercules.android.receiver.painter;

import android.graphics.Canvas;

import com.hercules.android.receiver.Receiver;
import com.hercules.android.receiver.ReceiverUtil;
import com.hercules.android.receiver.entities.XREView;

/**
 * <p>
 * This class is the base class of all painters.
 * </p>
 * 
 * @author TCSASSEMBER
 * @version 1.0
 */
public abstract class XREPainter {
    /**
     * Represents the <code>Receiver</code> instance.
     */
    protected Receiver receiver;

    /**
     * Constructor with a <code>Receiver</code> arguments.
     * 
     * @param receiver
     *            the <code>Receiver</code> instance.
     * @throws IllegalArgumentException
     *             if receiver if null
     */
    public XREPainter(Receiver receiver) {
        ReceiverUtil.checkNull("receiver", receiver);

        this.receiver = receiver;
    }

    /**
     * This method will paint the resource on canvas.
     * 
     * @param view
     *            the resource to paint
     * @param canvas
     *            the canvas that the resource painted on
     * @throws XREPainterException
     *             if any error occurs
     */
    public abstract void paint(XREView view, Canvas canvas) throws XREPainterException;
}
